#include <iostream>
#include <algorithm>
using namespace std;

inline void presentArray(const int arr[], const int &n) {
    for (int i = 0; i < n - 1; ++i)
        cout << arr[i] << " ";
    cout << arr[n-1] << endl;
}

int main() {
    int n, arr[10000] = {0};

    cin >> n;
    for (int i = 0; i < n; ++i) cin >> arr[i];

    for (int i = 1; i < n; ++i) {
        int v = arr[i];
        int j = i - 1;
        while (j >= 0 && arr[j] > v) {
            arr[j + 1] = arr[j];
            --j;
        }
        arr[j + 1] = v;
        presentArray(arr, n);
    }
    return 0;
}